
#import <XCTest/XCTest.h>
#import <al_lib_common/al_lib_common.h>
@interface Test : XCTestCase

@end

@implementation Test

- (void)setUp {
    // Put setup code here. This method is called before the invocation of each test method in the class.
    
    // In UI tests it is usually best to stop immediately when a failure occurs.
    self.continueAfterFailure = NO;
    
    // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this.
}

- (void)tearDown {
    // Put teardown code here. This method is called after the invocation of each test method in the class.
}
//ARLTimeUtils.h
- (void)testTimeUtils {
    NSString* currUTCDate = [ARLTimeUtils currUTCDate];
    NSString* currUTCDateCN = [ARLTimeUtils currUTCDateCN];
//    ARLLOGF(@"%ld",[ARLTimeUtils getDateTimeTOMilliSeconds:[NSDate date]]);
    ARLLOG(currUTCDateCN);
    ARLLOG(currUTCDate);
//    XCTAssertEqual(currUTCDateCN, currUTCDate,@"国内情况，失去应该一致，请检查");
}

// ARLColorUtils
- (void)testColorUtils {
    {
        UIColor* c1 = ColorFromHex(0xff00ff);
        NSString* c2 =  [ARLColorUtils hexStringColor:c1];
        XCTAssert([@"ff00ff" isEqualToString:c2],@"颜色转换有问题");
    }
    {
        UIColor* c1 = ColorFromHexA(0xf200ff,0.2);
        NSString* c2 =  [ARLColorUtils hexStringColorWithAlpha:c1];
        XCTAssert([@"f200ff33" isEqualToString:c2],@"颜色转换有问题");
    }
    
    //    XCTAssertEqual(currUTCDateCN, currUTCDate,@"国内情况，失去应该一致，请检查");
}

-(void)example{
    /*
     int a = [self.vc add:1 andB:2];
     //   0.直接失败
     XCTFail(@"失败"); // 测试失败
     1.bool类型比较
     BOOL res = a < 0;
     XCTAssert(res,@"失败时的提示"); //a是不是为true
     XCTAssertTrue(res,@"失败时的提示");//a是不是为true 不为true失败
     XCTAssertFalse(res,@"失败时的提示"); // ((a) is false) failed - 失败时的提示
     //    2.判断是不是nil
     NSString *strNil = nil;
     NSString *strNotNil = @"123";
     XCTAssertNil(strNil,@"判断对象是nil");//判断对象是nil
     XCTAssertNotNil(strNotNil,@"判断对象不是nil");
     //    3.判断是不是相等
     XCTAssertEqual(a, 3,@"失败时的提示");//比较两个表达式是不是相等
     XCTAssertNotEqual(a, 3,@"失败时的提示");
     //    XCTAssertEqualObjects(<#expression1#>, <#expression2, ...#>)//两个对象相等
     //    XCTAssertNotEqualObjects(<#expression1#>, <#expression2, ...#>)//两个对象不相等
     XCTAssertEqualWithAccuracy(1, 3, 3,@"误差为3以外");
     XCTAssertEqualWithAccuracy(1, 3, 1,@"误差为1以外");
     
     //  大小比较
     //
     XCTAssertGreaterThanOrEqual(a, 2,@"失败时的提示");//比较a是不是大于2
     XCTAssertGreaterThan(a, 3,@"失败时的提示");//((a) greater than (3)) failed: ("3") is not greater than ("3")
     XCTAssertLessThan(a, 4,@"不失败就没有提示");//a less than 4
     
     
     //    //异常测试
     NSArray *arr = @[@"1"];
     NSLog(@"arr : %@",arr[0]);
     //    NSLog(@"arr2 : %@",arr[2]);
     XCTAssertThrows(arr[0],@"arr[0]没有异常");//如果表达式没有异常,抛出一个失败
     XCTAssertNoThrow(arr[2],@"arr[2]抛出异常");//如果表达式异常,抛出一个失败
     */
    
}

- (void)testLaunchPerformance {
    if (@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 7.0, *)) {
        // This measures how long it takes to launch your application.
        [self measureWithMetrics:@[[[XCTApplicationLaunchMetric alloc] init]] block:^{
            [[[XCUIApplication alloc] init] launch];
        }];
    }
}

@end
